using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace SysTables
{
    public partial class AddAttributeForm : Form
    {

        MainWindow mParent;

        public AddAttributeForm(MainWindow Parent)
        {
            InitializeComponent();
            mParent = Parent;
        }


        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void AddAttributeForm_Load(object sender, EventArgs e)
        {

            
        }

        public void AddAttribute()
        {
            button1.Select();
            mName.Text = "";
            mLength.Text = "";
            mIsNull.Checked = false;
            ShowDialog();
        }




        private void button2_Click(object sender, EventArgs e)
        {
            Visible = false;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (mName.Text.Length > 0)
            {
                Visible = false; 
                mParent.AddAttribute(mName.Text, Attribute.Parse(mType.Text), Common.ParseInt(mLength.Text), mIsNull.Checked);
            }

        }
    }
}